<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2019/11/5
  Time: 23:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生选课系统</title>
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
        *{
            margin:0;
            padding:0;
        }
        .div{
            margin-top:30px;
            width:100%;
            font-size:20px;
            text-align:center;
        }
        .title{
            width: 100%;
            height: 50px;
            line-height: 80px;
            text-align: center;
            font-size: 30px;
            font-family: kaiti;
        }
    </style>
</head>
<body>
<div style="width:805px;height: 700px; margin: 0 auto">
    <div class="title">
        <form action="course_find" method="post">
            <b>学生本学期选课</b>
            <input type="text" name="course" style="height:30px;width: 100px;position: relative;left: 190px;top:5px">
            <button class="btn btn-info" style="position: relative;left: 190px">搜索</button>
        </form>
    </div>
    <div>
        <div class="div">
            <p>必修课列表</p>
            <table class="table table-striped">
                <thead style="background-color: #87CEFA;opacity: 0.9">
                <tr>
                    <th>课程号</th>
                    <th>课程名</th>
                    <th>上课时间</th>
                    <th>学分</th>
                    <th>任课教师</th>
                    <th>选课</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="data" items="${allListB}" >
                    <tr>
                        <td id="course_no">${data.course_no}</td>
                        <td>${data.course_name}</td>
                        <td hidden id="course_start">${data.course_start}</td>
                        <td>${data.course_start}~${data.course_end}</td>
                        <td>${data.course_socer}</td>
                        <td>${data.tea_name}</td>
                        <td hidden>${data.tea_account}</td>
                        <td hidden id="tea_account">${data.tea_account}</td>
                        <td><button class="btn btn_info" onclick="select(this)">选课</button></td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
            <p>选修课列表</p>
            <table class="table table-striped">
                <thead style="background-color: #87CEFA;opacity: 0.9">
                <tr>
                    <th>课程号</th>
                    <th>课程名</th>
                    <th>上课时间</th>
                    <th>学分</th>
                    <th>任课教师</th>
                    <th>选课</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="data" items="${allListX}" >
                    <tr>
                        <td id="course_no1">${data.course_no}</td>
                        <td>${data.course_name}</td>
                        <td hidden id="course_start1">${data.course_start}</td>
                        <td>${data.course_start}~${data.course_end}</td>
                        <td>${data.course_socer}</td>
                        <td>${data.tea_name}</td>
                        <td hidden id="tea_account1">${data.tea_account}</td>
                        <td><button class="btn btn_info" onclick="select1(this)">选课</button></td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
</div>
</body>
<script>

    var select = function(e){
        var course_no = $(e).parent().parent().children("#course_no").text();
        var tea_account = $(e).parent().parent().children("#tea_account").text();
        var course_start = $(e).parent().parent().children("#course_start").text();
        window.location.href='course_select?course_no='+course_no+'&tea_account='+tea_account+'&course_start='+course_start;
    }
    var select1 = function (e) {
        var course_no1 = $(e).parent().parent().children("#course_no1").text();
        var tea_account1 = $(e).parent().parent().children("#tea_account1").text();
        var course_start1 = $(e).parent().parent().children("#course_start1").text();
        window.location.href='course_select?course_no='+course_no1+'&tea_account='+tea_account1+'&course_start='+course_start1;
    }
    var msg="${msg}";
    if(msg!=null && msg!=""){
        alert(msg);
    }




</script>
</html>

